﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FirmaTransportowa
{
    public class ManagerPanelForm : Form
    {
        private Panel panel1;
        private Label managerDateAndTime;
        public Label managerName;
        private Label label1;
        private Timer timer1;
        private System.ComponentModel.IContainer components;
        private Panel panel2;
        private LinkLabel logout;
        private PictureBox pictureBox1;
        private Button newSalary;
        private Button salariesList;

        private ManagerPanelPresenter presenter;

        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.panel1 = new System.Windows.Forms.Panel();
            this.managerDateAndTime = new System.Windows.Forms.Label();
            this.managerName = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.panel2 = new System.Windows.Forms.Panel();
            this.logout = new System.Windows.Forms.LinkLabel();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.newSalary = new System.Windows.Forms.Button();
            this.salariesList = new System.Windows.Forms.Button();
            this.panel1.SuspendLayout();
            this.panel2.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.SuspendLayout();
            // 
            // panel1
            // 
            this.panel1.BackColor = System.Drawing.SystemColors.ControlLight;
            this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panel1.Controls.Add(this.managerDateAndTime);
            this.panel1.Location = new System.Drawing.Point(-5, 147);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(387, 38);
            this.panel1.TabIndex = 10;
            // 
            // managerDateAndTime
            // 
            this.managerDateAndTime.AutoSize = true;
            this.managerDateAndTime.ForeColor = System.Drawing.SystemColors.GrayText;
            this.managerDateAndTime.Location = new System.Drawing.Point(265, 9);
            this.managerDateAndTime.Name = "managerDateAndTime";
            this.managerDateAndTime.Size = new System.Drawing.Size(0, 13);
            this.managerDateAndTime.TabIndex = 2;
            // 
            // managerName
            // 
            this.managerName.AutoSize = true;
            this.managerName.ForeColor = System.Drawing.SystemColors.GrayText;
            this.managerName.Location = new System.Drawing.Point(125, 11);
            this.managerName.Name = "managerName";
            this.managerName.Size = new System.Drawing.Size(0, 13);
            this.managerName.TabIndex = 1;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.ForeColor = System.Drawing.SystemColors.GrayText;
            this.label1.Location = new System.Drawing.Point(8, 11);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(116, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Zalogowany kierownik:";
            // 
            // timer1
            // 
            this.timer1.Enabled = true;
            this.timer1.Interval = 1000;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick_1);
            // 
            // panel2
            // 
            this.panel2.BackColor = System.Drawing.SystemColors.ControlLight;
            this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.panel2.Controls.Add(this.logout);
            this.panel2.Controls.Add(this.managerName);
            this.panel2.Controls.Add(this.pictureBox1);
            this.panel2.Controls.Add(this.label1);
            this.panel2.Location = new System.Drawing.Point(-4, -4);
            this.panel2.Name = "panel2";
            this.panel2.Size = new System.Drawing.Size(395, 36);
            this.panel2.TabIndex = 14;
            // 
            // logout
            // 
            this.logout.ActiveLinkColor = System.Drawing.SystemColors.GrayText;
            this.logout.AutoSize = true;
            this.logout.LinkColor = System.Drawing.SystemColors.GrayText;
            this.logout.Location = new System.Drawing.Point(308, 11);
            this.logout.Name = "logout";
            this.logout.Size = new System.Drawing.Size(61, 13);
            this.logout.TabIndex = 10;
            this.logout.TabStop = true;
            this.logout.Text = "Wyloguj się";
            this.logout.VisitedLinkColor = System.Drawing.SystemColors.GrayText;
            this.logout.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.logout_LinkClicked);
            // 
            // pictureBox1
            // 
            this.pictureBox1.Image = global::FirmaTransportowa.Properties.Resources.key;
            this.pictureBox1.Location = new System.Drawing.Point(429, 5);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(38, 39);
            this.pictureBox1.TabIndex = 9;
            this.pictureBox1.TabStop = false;
            // 
            // newSalary
            // 
            this.newSalary.Image = global::FirmaTransportowa.Properties.Resources.payment;
            this.newSalary.Location = new System.Drawing.Point(24, 45);
            this.newSalary.Name = "newSalary";
            this.newSalary.Size = new System.Drawing.Size(90, 90);
            this.newSalary.TabIndex = 11;
            this.newSalary.Text = "Nowe wynagrodzenie";
            this.newSalary.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
            this.newSalary.UseVisualStyleBackColor = true;
            this.newSalary.Click += new System.EventHandler(this.newSalary_Click);
            // 
            // salariesList
            // 
            this.salariesList.Image = global::FirmaTransportowa.Properties.Resources.payment;
            this.salariesList.Location = new System.Drawing.Point(144, 45);
            this.salariesList.Name = "salariesList";
            this.salariesList.Size = new System.Drawing.Size(90, 90);
            this.salariesList.TabIndex = 15;
            this.salariesList.Text = "Lista wynagrodzeń";
            this.salariesList.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
            this.salariesList.UseVisualStyleBackColor = true;
            this.salariesList.Click += new System.EventHandler(this.salariesList_Click);
            // 
            // ManagerPanelForm
            // 
            this.ClientSize = new System.Drawing.Size(379, 179);
            this.Controls.Add(this.salariesList);
            this.Controls.Add(this.panel1);
            this.Controls.Add(this.panel2);
            this.Controls.Add(this.newSalary);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.HelpButton = true;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "ManagerPanelForm";
            this.Text = "Panel kierownika";
            this.HelpButtonClicked += new System.ComponentModel.CancelEventHandler(this.ManagerPanelForm_HelpButtonClicked);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.panel2.ResumeLayout(false);
            this.panel2.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.ResumeLayout(false);

        }

        public ManagerPanelForm(ManagerPanelPresenter presenter) {
            this.presenter = presenter;
            this.InitializeComponent();
        }

        private void ManagerPanelForm_HelpButtonClicked(object sender, System.ComponentModel.CancelEventArgs e)
        {
            HelpUtils.showHelp(this, 2);
        }

        private void logout_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            presenter.clean();
            LoginPresenter.showLoginView();
        }

        private void timer1_Tick_1(object sender, EventArgs e)
        {
            managerDateAndTime.Text = DateTime.Now.ToString();
        }

        private void newSalary_Click(object sender, EventArgs e)
        {
            presenter.showAddNewSalaryView();
        }

        private void salariesList_Click(object sender, EventArgs e)
        {
            presenter.showSalariesListView();
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.F1)
            {
                HelpUtils.showHelp(this, 2);
                return true;
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }
    }
}
